const { exec, escape } = require('../db/mysql')

module.exports = (req,res,next) => {
    const username = escape(req.session.username);
    const sql = `
        select name from t_user,t_role,user_role where username=${username} and t_user.id = user_role.user_id and user_role.role_id = t_role.id
    `;

    exec(sql).then(rows => {
        const { name } = rows[0]
    })
};